import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import api from '@/api/user'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
//引入axios
import axios from "axios"
import { VueJsonp } from 'vue-jsonp'    // 网上很多博客引用不加{}，会报错
import echarts from 'echarts'
Vue.prototype.$echarts = echarts

import dayjs from "dayjs";
// 定义全局的时间过滤器
Vue.filter('dateFormat', function (value) {
    let date = new Date(value * 1000);
    let year = date.getFullYear();
    let month = (date.getMonth() + 1 + '').padStart(2, '0');
    let day = (date.getDate() + '').padStart(2, '0');
    let hour = (date.getHours() + '').padStart(2, '0');
    let minute = (date.getMinutes() + '').padStart(2, '0');
    let second = (date.getSeconds() + '').padStart(2, '0');
    return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
})
// 引入组件
import ZkTable from 'vue-table-with-tree-grid'
Vue.use(ZkTable)

Vue.config.productionTip = false
Vue.prototype.$http = api;
require('./mock/mock')

Vue.prototype.$axios = axios
Vue.use(ElementUI);

Vue.prototype.bus = new Vue()
Vue.use(VueJsonp)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
